﻿Imports System.Data.OracleClient
Imports System.IO
Imports System.Collections.Generic
Imports System.Web.Security
Imports System.Data

Public Class BSCSCampaignReport
    'Inherits System.Web.UI.Page
    Inherits [lib].BasePage

    Dim DataEngine As New BSCSCampaignDefinition


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.PageTitle = "Kampanya Raporlama Bilgileri"
        Session("_CampaignReportDefinition") = Nothing

        If (Not IsPostBack) Then
            ddlDwhMnoType.Items.Clear()
            ddlDwhMnoType.DataSource = DataEngine.GetDwhMnoType()
            ddlDwhMnoType.DataBind()

            ddlDwhMnoType.Items.Insert(0, New ListItem("Seçiniz", "0"))
            ddlDwhMnoType.Items.Add(New ListItem("N/A", "-1"))
            ddlDwhMnoType.SelectedIndex = 0
        End If
    End Sub


    Protected Sub ddlSameAsTariff_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlSameAsTariff.SelectedIndexChanged
        If ddlSameAsTariff.SelectedValue.Equals("Yes") Then
            sameAsBox01_a.Visible = True
        Else
            txtKeywordGeneral.Text = Nothing
            lblErr01.Text = Nothing
            ddlSegmentReport.SelectedValue = Nothing
            sameAsLabel02.Text = Nothing
            ddlKytDetail.SelectedValue = Nothing
            sameAsLabel03.Text = Nothing            
            sameAsBox01_a.Visible = False
            sameAsBox01_b.Visible = False
            sameAsBox01_c.Visible = False
        End If

    End Sub

    Protected Sub btnSearchKeywordGeneral_Click(sender As Object, e As EventArgs) Handles btnSearchKeywordGeneral.Click
        ddlTariffListGeneral.Items.Clear()
        ddlTariffListGeneral.DataSource = DataEngine.GetGeneralTariffList(txtKeywordGeneral.Text.Trim())
        ddlTariffListGeneral.DataBind()
        If ddlTariffListGeneral.Items.Count = 0 Then
            lblErr01.Text = "Girdiğiniz değerle eşleşen bir tarife bulunamamıştır. Lütfen yeni bir değer giriniz."
            Return
        End If

        ddlTariffListGeneral.Items.Insert(0, New ListItem("Seçiniz", "0"))
        ddlTariffListGeneral.SelectedIndex = 0
        txtKeywordGeneral.Text = Nothing
        sameAsLabel01.Text = Nothing
        lblErr01.Text = Nothing
        sameAsBox01_a.Visible = False
        sameAsBox01_b.Visible = True
    End Sub

    Protected Sub ddlTariffListGeneral_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlTariffListGeneral.SelectedIndexChanged
        sameAsBox01_b.Visible = False
        sameAsLabel01.Text = ddlTariffListGeneral.SelectedValue.ToString & " - " & ddlTariffListGeneral.Items(ddlTariffListGeneral.SelectedIndex).ToString & " tarifesinden ""same as"" alınmıştır."
        sameAsBox01_c.Visible = True

        ddlSegmentReport.SelectedIndex = DataEngine.GetSegmentType(ddlTariffListGeneral.SelectedValue)
        ddlSegmentReport_SelectedIndexChanged(sender, e)
        If ddlSegmentReport.SelectedIndex <> 0 Then
            sameAsBox02_c.Visible = True
            sameAsLabel02.Text = ddlTariffListGeneral.SelectedValue.ToString & " - " & ddlTariffListGeneral.Items(ddlTariffListGeneral.SelectedIndex).ToString & " tarifesinden ""same as"" alınmıştır."
        End If

        ddlKytDetail.SelectedIndex = DataEngine.GetKytDetail(ddlTariffListGeneral.SelectedValue)
        ddlKytDetail_SelectedIndexChanged(sender, e)
        If ddlKytDetail.SelectedIndex <> 0 Then
            sameAsBox04_c.Visible = True
            sameAsLabel04.Text = ddlTariffListGeneral.SelectedValue.ToString & " - " & ddlTariffListGeneral.Items(ddlTariffListGeneral.SelectedIndex).ToString & " tarifesinden ""same as"" alınmıştır."
        End If


    End Sub

    Protected Sub ddlTariffType_SelectedIndexChanged(sender As Object, e As EventArgs)

    End Sub

    Protected Sub ddlSegmentReport_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlSegmentReport.SelectedIndexChanged

    End Sub

    Protected Sub ddlKytDetail_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ddlKytDetail.SelectedIndexChanged

    End Sub
End Class